<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<link rel="shortcut icon" th:href="@{/img/favicon.ico}"/>
<link rel="bookmark" th:href="@{/img/favicon.ico}" type="image/x-icon"/>
<link th:href="@{/css/style.css}" rel="stylesheet" type="text/css" />
<script type="text/javascript" th:src="@{/js/jquery.js}"></script>
<script type="text/javascript">
function tipOpen(ele) {
  var bid=$(ele).prev().prev().val();
  var status=$(ele).prev().val();
  if(status==1){
    $(".tipright p").text("是否注销当前品牌？");
  }else{
    $(".tipright p").text("是否恢复当前品牌？");
  }
  $("#cbid").val(bid);
  $("#tip").fadeIn(200);
}

function goupdate() {
  var bid=$("#cbid").val();
  window.location.href="/erp/purchase/brand/updateState/"+bid;
}

function tipClose2() {
  $("#tip").fadeOut(200);
}

function goPage(num) {
  //alert(num);
  $("#pageno").val(num);
  $("#brandform").submit();
}
</script>
</head>

<body>
<div class="place"> <span>位置：</span>
  <ul class="placeul">
    <li>采购管理</li>
    <li><a th:href="@{/purchase/brand/brandAll}">品牌管理</a></li>
    <li>基本内容</li>
  </ul>
</div>
<div class="rightinfo">
  <form th:action="@{/purchase/brand/brandAll}" method="post" id="brandform">
    <input type="hidden" name="pageno" value="1" id="pageno"/>
    <ul class="tools">
      <li> 品牌名称:
        <input type="text" name="brandName" th:value="${cBrand.brandName}" />
      </li>
      <li> 状态：
        <select name="brandStatus">
          <option value="0">请选择</option>
          <option value="1" th:selected="${cBrand.brandStatus==1}?'true':'false'">可用</option>
          <option value="2" th:selected="${cBrand.brandStatus==2}?'true':'false'">不可用</option>
        </select>
      </li>
      <li class="subBut" onclick="goPage(1)"><img th:src="@{/images/t06.png}" />查询</li>
      <li class="subBut" onclick="window.location.href='brandAdd.html'"><img th:src="@{/images/t01.png}" />添加</li>
    </ul>
    <table class="tablelist">
      <thead>
        <tr>
          <th>序号</th>
          <th>品牌名称</th>
          <th>状态</th>
          <th>创建时间</th>
          <th>创建人</th>
          <th>操作</th>
        </tr>
      </thead>
      <tbody>
        <tr th:each="b :${cbpage.list}">
          <td th:text="${b.brandId}">1</td>
          <td th:text="${b.brandName}">联想</td>
          <td th:text="${b.brandStatus==1?'可用':'不可用'}">可用</td>
          <td th:text="${#dates.format(b.createTime,'yyyy-MM-dd HH:mm:ss')}">2013-09-09 15:05:05</td>
          <td th:text="${b.createId==null?'':b.users.uname}">管理员</td>
          <td>
            <a th:href="@{'/purchase/brand/goBrandUpdate/'+${b.brandId}}" class="tablelink">修改</a>
            <input type="hidden" th:value="${b.brandId}"/>
            <input type="hidden" th:value="${b.brandStatus}"/>
            <a href="javascript:void(0)" class="tablelink" onclick="tipOpen(this)" th:text="${b.brandStatus==1?'注销':'恢复'}">注销</a>

          </td>
        </tr>

      </tbody>
    </table>
    <div class="pagin">
      <div class="message">共<i class="blue" th:text="${cbpage.total}"></i>条记录，当前显示第&nbsp;<i class="blue" th:text="${cbpage.pageNum}">2&nbsp;</i>页</div>
      <ul class="paginList">
        <li class="paginItem">
          <a href="javascript:void(0);" th:onclick="goPage([[${cbpage.isFirstPage?1:cbpage.pageNum-1}]])">
            <span th:class="${cbpage.isFirstPage?'pagepre':'pagenxt roate'}"></span>
          </a>
        </li>
        <li th:class="${page==cbpage.pageNum?'paginItem current':'paginItem'}"
            th:each="page : ${cbpage.navigatepageNums}">
          <a href="javascript:;"  th:text="${page}" th:onclick="goPage([[${page}]])">1</a>
        </li>
        <li class="paginItem">
          <a href="javascript:void(0);" th:onclick="goPage([[${cbpage.isLastPage?cbpage.pages:cbpage.pageNum+1}]])">
            <span th:class="${cbpage.isLastPage?'pagepre roate':'pagenxt'}"></span>
          </a>
        </li>
      </ul>
    </div>

  </form>

  <!-- 提示框 -->
  <div id="tip" class="tip">
    <div class="tiptop"><span>提示信息</span><a th:onclick="tipClose2()"></a></div>
    <div class="tipinfo"> <span><img th:href="@{/images/ticon.png}" /></span>
      <div class="tipright">
        <p></p>
        <cite>如果是请点击确定按钮 ，否则请点取消。</cite> </div>
      <input id="cbid" type="hidden"/>
    </div>
    <div class="tipbtn">
      <input name="" type="button"  class="sure" value="确定" onclick="goupdate()" />
      &nbsp;
      <input name="" type="button"  class="cancel" value="取消" onclick="tipClose2()" />
    </div>
  </div>
</div>
<script type="text/javascript">
    $('.tablelist tbody tr:odd').addClass('odd');
</script>
</body>
</html>
